import { defineConfig } from 'umi';

import defaultSettings from './defaultSettings';
import proxy from './proxy';
import routes from './routes';
import { APP_OSS, APP_NAME, APP_PROXY, APP_WXCONFIG } from '../sfe';

const { REACT_APP_ENV } = process.env;

export default defineConfig({
  hash: true,
  base: `/${APP_NAME}/`,
  outputPath: 'dist',
  antd: {},
  define: {
    APP_OSS: `${APP_OSS}`,
    APP_NAME: `${APP_NAME}`,
    APP_PROXY: `${APP_PROXY}`,
    APP_WXCONFIG: `${APP_WXCONFIG}`,
    APP_ENV_TEST: `https://ued.sousoushenbian.cn/`,
    APP_ENV_PROD: `https://web.sousoushenbian.cn/`,
    REACT_APP_ENV: REACT_APP_ENV || false,
  },
  layout: {
    locale: true,
    siderWidth: 208,
    ...defaultSettings,
  },
  locale: {
    default: 'zh-CN',
    antd: true,
    baseNavigator: true,
  },
  dynamicImport: {
    loading: '@ant-design/pro-layout/es/PageLoading',
  },
  targets: {
    ie: 11,
  },
  routes,
  theme: {
    'primary-color': defaultSettings.primaryColor,
  },
  esbuild: {},
  title: false,
  ignoreMomentLocale: true,
  proxy: proxy[REACT_APP_ENV || 'dev'],
  manifest: {
    basePath: '/',
  },
  fastRefresh: {},
  nodeModulesTransform: { type: 'none' },
  mfsu: {},
  webpack5: {},
  exportStatic: {},
  // plugins: ['@alitajs/sentry'],
  // sentry: {
  //   dsn: 'https://1a107396163640cda8382a7a943fc899@o975314.ingest.sentry.io/5933114',
  // },
});
